import request from "@/utils/request";

//1.查询品牌列表参数类型
export interface reqTrademarkListParamType {
  page: number;
  limit: number;
}
//返回的records每一项类型
export interface reqTrademarkItemType extends reqAddTrademarkParamType{
    id:number
}
export type reqTrademarkRecordsType = reqTrademarkItemType[]
//查询品牌列表返回值类型
export interface reqTrademarkReturnType {
  records: reqTrademarkRecordsType;
  total: number;
  size: number;
  current: number;
  searchCount: boolean;
  pages: number;
}
export const requestTrademarkList = ({
  page,
  limit,
}: reqTrademarkListParamType) => {
  return request.get<any,reqTrademarkReturnType>(`/admin/product/baseTrademark/${page}/${limit}`);
};


//2.修改品牌
export const reqUpdateTrademark = (trademark:reqTrademarkItemType) => {
    return request.put<any,null>("/admin/product/baseTrademark/update",trademark)
}


//3.新增品牌
export interface reqAddTrademarkParamType{
    tmName:string,
    logoUrl:string
}
export const reqAddTrademark = (trademark:reqAddTrademarkParamType) => {
    return request.post<any,null>('/admin/product/baseTrademark/save',trademark)
}

//4.删除品牌
export const reqDeleteTrademark = (id:number) => {
    return request.delete<any,null>(`/admin/product/baseTrademark/remove/${id}`)
}
//5.获取全部品牌列表
export const requestAllTrademark = () => {
  return request.get<any,reqTrademarkRecordsType>('/admin/product/baseTrademark/getTrademarkList')
}